import paramiko
num = 84
host_file = 'host'+str(num)
#读入需要分配的主机文件
with open('{}_list.txt'.format(host_file)) as f:
    myhost = f.readlines()

temp = 30
with paramiko.SSHClient() as client:
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

    client.connect('10.{}.{}.3'.format(num,temp), 22, 'root', 'kuaicdn')

    stdin, stdout, stderr = client.exec_command("ip a")
    #这里是返回值，这里去除所属地localBelong的值
    localBelong = stdout.readlines()
    print(localBelong)
    #for i in range(1, len(myhost)):
    with client.open_sftp() as sftp:
        sftp.put('remote/{}_{}.txt'.format(host_file,temp),'/root/pppoe/account.txt')
